SPB Git

spb/spinza

Public
1008 B · 23 lines tsx
1import type { Metadata } from "next";2import { notFound } from "next/navigation";3import { apiServer } from "@/lib/api-server";4import type { GameInfo } from "@spinza/shared";5import type { ClientDefinition } from "@/components/game/types";6import { GameClient } from "@/components/game/game-client";78type Params = { params: Promise<{ slug: string }> };910export async function generateMetadata({ params }: Params): Promise<Metadata> {11  const { slug } = await params;12  const data = await apiServer<{ game: GameInfo }>(`/api/games/${slug}`);13  if (!data) return { title: "Game not found" };14  return { title: `${data.game.name} — play free`, description: data.game.description, robots: { index: false } };15}1617export default async function GamePage({ params }: Params) {18  const { slug } = await params;19  const data = await apiServer<{ game: GameInfo; definition: ClientDefinition }>(`/api/games/${slug}`);20  if (!data) notFound();21  return <GameClient game={data.game} definition={data.definition} />;22}23
Files · 3b4179a710ab1cd5f12ca7cfd253b81674f1521e
Menu

Theme